package com.javalab._6feature._1enum;

public enum Operator {
    ADD("+"),
    SUBTRACT("-"),
    MULTIPLY("*"),
    DIVIDE("/"),
    UNKNOWN("unknown");
    private String value;
    Operator(String value) {
        this.value = value;
    }
    public static Operator parse(String t) {
        if (t == null) {
            return UNKNOWN;
        }
        for (Operator value : values()) {
            if (value.value.equals(t)) {
                return value;
            }
        }
        return UNKNOWN;
    }

    public String getValue() {
        return value;
    }
}
